package com.yulongtian.oneProblemEveryDay.month202301;

/**
 * https://leetcode.cn/problems/count-integers-with-even-digit-sum/
 * 可
 *
 * @author yulongTian
 * @create 2023-01-06 9:28
 */
public class Test05 {
    public static void main(String[] args) {
        System.out.println(countEven(30));
    }

    public static int countEven(int num) {
        int ans = 0;
        for (int i = 1; i <= num; i++) {
            int tempSum = 0;
            int tempNum = i;
            while (tempNum > 0) {
                tempSum += tempNum % 10;
                tempNum /= 10;
            }
            if ((tempSum & 1) == 0) {
                ans++;
            }
        }

        return ans;
    }
}
